<template>
  <view class="container">
    <view class="hidden-title">签批记录</view>
    <view class="background-white">
      <view
        class="flex text-content"
        v-for="(item, index) in records"
        :key="index"
      >
        <view class="flex text-line">
          {{ item.operateProcessLabel }}：<text>{{ item.createUserName }}</text>
          <text class="ml-20">{{ item.createTime }}</text>
          <image
            v-if="item.signatureUrls"
            :src="`${staticUrl}${item.signatureUrls}`"
            mode="aspectFit"
            class="work-img ml-20"
            @click="handlePreviewImage(`${staticUrl}${item.signatureUrls}`)"
          ></image>
          <text
            v-if="item.result"
            class="ml-20"
            :style="{ color: item.result === 'Y' ? '#4B7902' : '#EC808D' }"
            >{{ item.result === 'Y' ? '通过' : '不通过' }}
          </text>
        </view>
        <text v-if="item.result && item.result === 'N'" class="no-content">
          不通过意见：{{ item.remark }}
        </text>
      </view>
    </view>
  </view>
</template>

<script>
import { getElectricHistory } from '@/api/spw/powerCut.js';
import { staticUrl } from '@/config.js';
export default {
  data() {
    return {
      records: [],
      ticketId: '',
      staticUrl,
    };
  },
  onLoad(option) {
    this.ticketId = option.ticketId;
    getElectricHistory(this.ticketId).then(({ data }) => {
      this.records = data;
    });
  },
  methods: {
    handlePreviewImage(url) {
      uni.previewImage({
        urls: [url],
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.container {
  .background-white {
    background-color: #fff;
    padding: 20rpx 30rpx;
    box-sizing: border-box;

    .uni-forms-item__label {
      color: #333;
      font-size: 30rpx;
    }
    .text-content {
      flex-direction: column;
    }
    .no-content {
      margin-left: 100rpx;
      color: #aeaeae;
    }
    .text-line {
      height: 80rpx;
      align-items: center;
      font-size: 15px;
    }

    .bor-btm {
      display: flex;
      border-bottom: 1px solid #d5d7e3;
    }

    .work-img {
      width: 140rpx;
      height: 80rpx;
    }

    .text {
      padding-bottom: 20rpx;
      padding-top: 4rpx;
      color: #333;

      text {
        color: #666;
      }
    }
  }
}

.hidden-title {
  background: #f5f5f5;
  padding: 20rpx;
  color: #999;
}

.bor-top {
  border-top: 20rpx solid #f5f5f5;
}

.submit-group {
  background: #fff;
  z-index: 9;
  padding: 30px;
}

.u-button {
  width: 600rpx;
}
</style>
